﻿<Table TItem="BindItem"
       IsPagination="true" PageItemsSource="@PageItemsSource"
       IsStriped="true" IsBordered="true" AutoGenerateColumns="true"
       ShowToolbar="false" IsMultipleSelect="true" ShowExtendButtons="false"
       OnQueryAsync="@OnQueryAsync">
    <TableColumns>
        <TableColumn @bind-Field="@context.Complete">
            <Template Context="v">
                <Switch IsDisabled="true" Value="v.Value" ShowInnerText="true" OnInnerText="是" OffInnerText="否" />
            </Template>
        </TableColumn>
    </TableColumns>
</Table>

@code {
    public class BindItem
    {
        [DisplayName("主键")]
        [AutoGenerateColumn(Ignore = true)]
        public int Id { get; set; }

        [DisplayName("姓名")]
        [Required(ErrorMessage = "姓名不能为空")]
        [AutoGenerateColumn(Order = 10)]
        public string? Name { get; set; }

        [DisplayName("日期")]
        [AutoGenerateColumn(Order = 1, FormatString = "yyyy-MM-dd")]
        public DateTime? DateTime { get; set; }

        [DisplayName("地址")]
        [Required(ErrorMessage = "地址不能为空")]
        [AutoGenerateColumn(Order = 20)]
        public string? Address { get; set; }

        [DisplayName("数量")]
        [AutoGenerateColumn(Order = 40)]
        public int Count { get; set; }

        [DisplayName("是/否")]
        [AutoGenerateColumn(Order = 50)]
        public bool Complete { get; set; }

        [Required(ErrorMessage = "请选择学历")]
        [DisplayName("学历")]
        [AutoGenerateColumn(Order = 60)]
        public EnumEducation? Education { get; set; }
    }
}